<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>药品库存管理</title>
    <link rel="stylesheet" href="../css/inventory.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/inventory.js"></script>
</head>
<body>
<div id="flex">
<div id="selectInventoryNameInput">
    <label for="nameInventoryInput">查询历史记录</label>
    <input type="text" id="nameInventoryInput" placeholder="请输入药品名称">
    <button class="inventory-select-btn" id="inventoryNameSelectBtn">点击查询</button>
</div>
</div>
<hr>
<!--表格-->
<div class="inventory-history-information">
    <!--<hr style="height: 2px">-->
    <table id="tb_4" cellspacing="0" cellpadding="2" width="100%" border="1">
        <tbody>
        <tr align="center" bgcolor="#dcdcdc">
            <td style="width:100px;">编号</td>
            <td>药品名称</td>
            <td>规格</td>
            <td>单位</td>
            <td>库存量</td>
            <td>有效期</td>
            <td>备注</td>
        </tr>
        <!--<tr>-->
            <!--<td style="width:100px;">201901041643</td>-->
            <!--<td>药品名称</td>-->
            <!--<td>12</td>-->
            <!--<td>2019/01/04</td>-->
            <!--<td>300</td>-->
            <!--<td>无</td>-->
            <!--<td>无</td>-->
        <!--</tr>-->
        </tbody>
    </table>
</div>

<!-- 编辑页面 -->
<div class="all-inventory-update-input">
    <div><label for="inventory-update-input-name">药品名称</label>
        <input class="inventory-update-input" type="text" id="inventory-update-input-name" value="" readonly="readonly">
    </div>
    <div><label for="inventory-update-input-type">规格</label>
        <input class="inventory-update-input" type="text" id="inventory-update-input-type" value="" readonly="readonly">
    </div>
    <div><label for="inventory-update-input-unit">单位</label>
        <input class="inventory-update-input" type="text" id="inventory-update-input-unit" value="" readonly="readonly">
    </div>
    <div><label for="inventory-update-input-count">库存量</label>
        <input class="inventory-update-input" type="number" id="inventory-update-input-count" value="">
    </div>
    <div><label for="inventory-update-input-useData">有效期</label>
        <input class="inventory-update-input" type="text" id="inventory-update-input-useData" value="">
    </div>
    <div><label for="inventory-update-input-remark">备注</label>
        <input class="inventory-update-input" type="text" id="inventory-update-input-remark" value="">
    </div>
    <div class="inventory-add-button">
        <button id="addInventory-update-sure" type="submit">确认</button>
        <button id="addInventory-update-back" type="submit">返回</button>
    </div>
</div>
<div id="over"></div>

<!--添加新药-->
<div class="addNewMec">
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoNumber">新药编号</label>
        <input type="text" class="addNewMecInputInfo" id="addNewMecInputInfoNumber" placeholder="输入新药编号">
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoName">新药名称</label>
        <input type="text" class="addNewMecInputInfo" id="addNewMecInputInfoName" placeholder="输入新药名称">
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoUnit">新药单位</label>
        <input type="text" class="addNewMecInputInfo" id="addNewMecInputInfoUnit" placeholder="输入新药单位">
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoSpec">新药规格</label>
        <input type="text" class="addNewMecInputInfo" id="addNewMecInputInfoSpec" placeholder="输入新药规格">
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoType">新药类别</label>
        <select class="addNewMecInputInfo" id="addNewMecInputInfoType">
            <!--<option>请选择药品类别</option>-->
        </select>
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoSui">新药供应商</label>
        <select class="addNewMecInputInfo" id="addNewMecInputInfoSui">
            <!--<option>请选择药品供应商</option>-->
        </select>
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoCom">新药生产商</label>
        <input type="text" class="addNewMecInputInfo" id="addNewMecInputInfoCom" placeholder="输入新药生产商">
    </div>
    <div class="addNewMecInput">
        <label for="addNewMecInputInfoRem">新药备注</label>
        <input type="text" class="addNewMecInputInfo" id="addNewMecInputInfoRem" placeholder="输入新药备注">
    </div>
    <div class="addNewMecBtn">
        <button id="addNewMecBtnSure" type="submit">确认</button>
        <button id="addNewMecBtnBack" type="submit">返回</button>
    </div>
</div>
<script type="text/javascript">
    var tTD; //用来存储当前更改宽度的Table Cell,避免快速移动鼠标的问题
    var table = document.getElementById("tb_4");
    for (j = 0; j < table.rows[0].cells.length; j++) {
        table.rows[0].cells[j].onmousedown = function () {
//记录单元格
            tTD = this;
            if (event.offsetX > tTD.offsetWidth - 10) {
                tTD.mouseDown = true;
                tTD.oldX = event.x;
                tTD.oldWidth = tTD.offsetWidth;
            }
//记录Table宽度
//table = tTD; while (table.tagName != ‘TABLE') table = table.parentElement;
//tTD.tableWidth = table.offsetWidth;
        };
        table.rows[0].cells[j].onmouseup = function () {
//结束宽度调整
            if (tTD == undefined) tTD = this;
            tTD.mouseDown = false;
            tTD.style.cursor = 'default';
        };
        table.rows[0].cells[j].onmousemove = function () {
//更改鼠标样式
            if (event.offsetX > this.offsetWidth - 10)
                this.style.cursor = 'col-resize';
            else
                this.style.cursor = 'default';
//取出暂存的Table Cell
            if (tTD == undefined) tTD = this;
//调整宽度
            if (tTD.mouseDown != null && tTD.mouseDown == true) {
                tTD.style.cursor = 'default';
                if (tTD.oldWidth + (event.x - tTD.oldX) > 0)
                    tTD.width = tTD.oldWidth + (event.x - tTD.oldX);
//调整列宽
                tTD.style.width = tTD.width;
                tTD.style.cursor = 'col-resize';
//调整该列中的每个Cell
                table = tTD;
                while (table.tagName != 'TABLE') table = table.parentElement;
                for (j = 0; j < table.rows.length; j++) {
                    table.rows[j].cells[tTD.cellIndex].width = tTD.width;
                }
//调整整个表
//table.width = tTD.tableWidth + (tTD.offsetWidth – tTD.oldWidth);
//table.style.width = table.width;
            }
        };
    }
</script>
</body>
</html>